'use strict'
const { query } = require('../app/helper/db');

module.exports.up = function (next) {
  query(`
    CREATE TABLE product (
      id int(11) unsigned NOT NULL AUTO_INCREMENT,
      name varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL comment '',
      online int(11) unsigned NOT NULL comment '',
      categoryid int(11) unsigned NOT NULL comment '',
      storeid int(11) unsigned NOT NULL comment '',
      createdat int(11) NOT NULL comment '',
      PRIMARY KEY (id)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
  `).then(() => {
    next();
  }).catch(err => {
    throw err;
  })
}

module.exports.down = function (next) {
  next()
}
